package com.tongji.diy.view
{
	import com.tongji.diy.event.BuildRoomEvent;
	import com.tongji.diy.view.component2D.OriginalRoom;
	
	import flash.events.MouseEvent;
	
	import org.robotlegs.mvcs.Mediator;
	
	import spark.components.Group;
	
	public class ScrollingRoomMediator extends Mediator
	{
		[Inject]
		public var view:ScrollingRoomContent;
		
		override public function onRegister():void
		{
			view.addEventListener(MouseEvent.MOUSE_DOWN, listMouseDownHandler);
		}
		
		private function listMouseDownHandler(event:MouseEvent):void
		{
			dispatch(new BuildRoomEvent(BuildRoomEvent.BUILD_ROOM, new OriginalRoom(view.getChildIndex(event.target as Group))))
		}
		
	}
}